var exec = require('child_process').exec;

module.exports.default = function (cmd) {
  return new Promise((resolve, reject) => {
    exec(cmd, function (error, stdout, stderr) {
      // 获取命令执行的输出
      if (error) {
        reject({
          stderr,
          stdout
        });
      } else {
        resolve({
          stdout,
        });
      }

    });
  });
}
